<?php

/**
 * This is the model class for table "mean_of_egress".
 *
 * The followings are the available columns in table 'mean_of_egress':
 * @property integer $id
 * @property integer $readily_accessible
 * @property integer $obstructed
 * @property integer $travel_distance_within_limit
 * @property integer $dead_end_within_limit
 * @property integer $adequate_illumination
 * @property integer $proper_rating_of_illumination
 * @property integer $panic_hardware_operational
 * @property integer $door_swing_in_the_direction_of_exit
 * @property integer $door_open_easily
 * @property integer $self_closure_operational
 * @property integer $building_with_mezzanine
 * @property integer $mezzanine_with_proper_exit
 * @property integer $corridor_and_aisle_of_sufficient_size
 * @property integer $exit_detail_id
 *
 * The followings are the available model relations:
 * @property ExitDetail $exitDetail
 */
class MeanOfEgress extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return MeanOfEgress the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'mean_of_egress';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('exit_detail_id', 'required'),
			array('readily_accessible, obstructed, travel_distance_within_limit, dead_end_within_limit, adequate_illumination, proper_rating_of_illumination, panic_hardware_operational, door_swing_in_the_direction_of_exit, door_open_easily, self_closure_operational, building_with_mezzanine, mezzanine_with_proper_exit, corridor_and_aisle_of_sufficient_size, exit_detail_id', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, readily_accessible, obstructed, travel_distance_within_limit, dead_end_within_limit, adequate_illumination, proper_rating_of_illumination, panic_hardware_operational, door_swing_in_the_direction_of_exit, door_open_easily, self_closure_operational, building_with_mezzanine, mezzanine_with_proper_exit, corridor_and_aisle_of_sufficient_size, exit_detail_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'exitDetail' => array(self::BELONGS_TO, 'ExitDetail', 'exit_detail_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'readily_accessible' => 'Readily Accessible',
			'obstructed' => 'Obstructed',
			'travel_distance_within_limit' => 'Travel Distance Within Limit',
			'dead_end_within_limit' => 'Dead End Within Limit',
			'adequate_illumination' => 'Adequate Illumination',
			'proper_rating_of_illumination' => 'Proper Rating Of Illumination',
			'panic_hardware_operational' => 'Panic Hardware Operational',
			'door_swing_in_the_direction_of_exit' => 'Door Swing In The Direction Of Exit',
			'door_open_easily' => 'Door Open Easily',
			'self_closure_operational' => 'Self Closure Operational',
			'building_with_mezzanine' => 'Building With Mezzanine',
			'mezzanine_with_proper_exit' => 'Mezzanine With Proper Exit',
			'corridor_and_aisle_of_sufficient_size' => 'Corridor And Aisle Of Sufficient Size',
			'exit_detail_id' => 'Exit Detail',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('readily_accessible',$this->readily_accessible);
		$criteria->compare('obstructed',$this->obstructed);
		$criteria->compare('travel_distance_within_limit',$this->travel_distance_within_limit);
		$criteria->compare('dead_end_within_limit',$this->dead_end_within_limit);
		$criteria->compare('adequate_illumination',$this->adequate_illumination);
		$criteria->compare('proper_rating_of_illumination',$this->proper_rating_of_illumination);
		$criteria->compare('panic_hardware_operational',$this->panic_hardware_operational);
		$criteria->compare('door_swing_in_the_direction_of_exit',$this->door_swing_in_the_direction_of_exit);
		$criteria->compare('door_open_easily',$this->door_open_easily);
		$criteria->compare('self_closure_operational',$this->self_closure_operational);
		$criteria->compare('building_with_mezzanine',$this->building_with_mezzanine);
		$criteria->compare('mezzanine_with_proper_exit',$this->mezzanine_with_proper_exit);
		$criteria->compare('corridor_and_aisle_of_sufficient_size',$this->corridor_and_aisle_of_sufficient_size);
		$criteria->compare('exit_detail_id',$this->exit_detail_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}